Method for improving functionality of the binary representation of mpeg-7 and of other xml-based contents descriptions

ABSTRACT

The invention is essentially characterized in that two different schema branch codes are used, whereby one of the two is utilized far more frequently and, as a consequence, effects a compression. The schema branch code and position code are combined, and the bit length for the schema branch code is transmitted therewith. This results in simplifying the search function in such a manner that the first part, alone, specifies the type of the referenced element and that an improvement in the extensibility is achieved based on a schema version number to be transmitted and on firmly prescribed extension strategies that are also familiar to the decoder.

[0001] The invention relates to the coding and decoding of structured documents based on XML, such as are provided for by MPEG-7, for example. XML (extensible markup language) is a standard for the definition of document structures, and is used for representing structured data in a text file, and forms the basis for the language XHTML, for example. Such documents structured on an XML basis are based on a set of structured elements—also referred to in the following as a “schema”—such as can be specified using, for example, a document type definition (DTD), an XML schema, or multi-media description schemes (DS).

[0002] A draft paper from the ISO/IEC, namely CD 15938-1 Information Technology—Multimedia Content Description Interface: Systems, ISO/IEC JTC 1 SC29/WG11/N3701, La Baule (France), October 2000, in particular on pages 15 to 22, discloses the binary format of MPEG-7 files and the structure of navigation paths using tree branch code tables.

[0003] This invention is concerned with the optimization of the coding of structured XML documents. The underlying object of the invention is thus to specify methods for improving the functionality of the binary representations of XML-based content descriptions, in particular for MPEG-7 documents, using which the data set to be transmitted will be as small as possible, search operations within the document will be as simple as possible, and using which any extensions to an instanced document which are not contained in the schema template can be effected with the least possible effort.

[0004] The invention achieves this object by the attributes of Patent claims 1, 2, 5, 7 and 8. The additional claims relate to advantageous developments based on the method in accordance with the invention.

[0005] One of the consequences of the ISO/IEC draft mentioned above is that the structure of an XML document can be interpreted as a data tree, where each element of the description corresponds to a node in this tree. The structure of the nodes is defined by the definition in the schema on which the document is based. In particular, the type and number of child-elements are defined by it. An example of a prototype for such a node is shown on page 19 of this draft. These tree-structure nodes consist of the name of the element or complex type, a field with TBC words (Tree Branch Code), which are used for referencing the child-elements, and the tree branches which represent the references to the appropriate child-elements. It is also possible to deduce from the draft that the TBCs break down into two components, namely a schema branch and an item of position data, where the schema data is derived from the elements which occur as child-elements in the schema, while the item of position data contains the position data for those elements which can occur repeatedly. Here, the possible types of child-element are elements of the type Complex Type, which can in turn contain child-elements, or alternatively elements of type Simple Type or Attribute, which cannot contain a child-element. The length of the field #position is determined by the maximum number (“maxOccurs”) of the element concerned, which is specified in the schema. To cover the situation that, in the example here, the maximum number is greater than 7 or is unbounded, the field is lengthened adaptively, until it is possible to represent the position to be encoded. This breakdown has the property that the schema branch code or SBC #SchemaBranch code is always the same, regardless of how many children are or could be present in the current instantiation.

[0006] In order to move around within the document, the TBCs, i.e. the SchemaBranch codes and where applicable any PositionCodes, are put in sequence, which produces a path in the document. When the desired element is reached, the last code is inserted in the table. If the desired element cannot have any more children, that is it is an Attribute or a Simple Type, then this termination code is unnecessary and is not sent. In this case, the Attribute or the Simple Type element is then transmitted in coded form.

[0007] The invention is explained in more detail below by reference to the examples shown in the diagrams. These show:

[0008]FIGS. 1a to 1 d, the addressing of various element types, to explain the improvement in compression,

[0009]FIG. 2, an XML schema text,

[0010]FIGS. 2a and 2 b, the node tables for the schema text in FIG. 2,

[0011]FIGS. 3a and 3 b, diagrams to explain an improvement in the search possibilities in accordance with the invention,

[0012]FIGS. 4 and 4a, sections of the data stream to explain the improvement in extensibility,

[0013]FIGS. 5a and 5 b, representations of extended tree branch nodes to explain the improvement in extendibility,

[0014]FIGS. 6a and 6 b, as FIG. 2 and FIG. 2b, but with extended elements, and

[0015]FIGS. 7 and 8, a sequence for a decoder to skip over unknown elements.

[0016] The invention consists essentially in the use of two different schema branch codes, of which one is far more frequently used and thus effects a compression, the schema branch code and the position code are combined and the bit length for the schema branch code is transmitted with them, with the search function being simplified in that the first part alone specifies the type of element referenced, and in that improved extendibility is achieved on the basis of a schema version number which must be transmitted, together with fixed predefined extension strategies which are also known to the decoder.

[0017] Improvement in Compression

[0018]FIG. 1 shows a method used until now for addressing a Simple Type element or Attribute, and FIG. 1b shows a method of addressing a Complex Type element in a way corresponding to the familiar methods. FIGS. 1c and 1 d show the corresponding forms of address with the method according to the invention. This makes it clear that use is made of two different schema branch codes SBC-A and SBC-B, and not the general schema branch code SBC-B alone. As initially mentioned, such an address path consists of TBC codes chained together, which means that if necessary there may also be position codes #pos between the schema branch codes SBC-A, and only at the end will there be a schema branch code SBC-A with a path termination code and no further position specifications, followed by a general schema branch code SBC-B, which can also contain Simple Type elements or Attributes, which form the leaves of the tree-type structure.

[0019] From the structure described for the path, comprising chained TBC codes, it can be seen that only the last TBC of the path can refer to an Attribute or a Simple Type element. All the preceding TBCs must refer to Complex Type elements, because only these can have child elements. In the method according to the invention, two different tables for the #SchemaBranch codes SBC are now introduced for each node, with the objective of reducing the length of the code for positioning within the document by comparison with that in the ISO/IEC draft mentioned above. Table A contains only the elements of Complex Type, that is to say those elements which can have child elements. The other table contains all the elements, i.e. including the Attributes and the Simple Type elements. It should be noted that no SBC needs to be reserved for the path termination. The #SchemaBranch codes in the two tables are referred to below as SBC-A and SBC-B respectively. The complete path is now in turn formed by chaining together TBCs, with all the TBCs except the last being formed using SBC-A and, where applicable, the appropriate #Position codes. The end of the first part of the path, created using Table A, is signaled by a termination code, for example all bits 1. There then follows exactly one TBC, the #SchemaBranch code for which is taken from Table B. It should be noted that, in the method according to the invention, the termination code must also be sent if an Attribute or a Simple Type element is addressed. As the length of the #SchemaBranch codes depends on the number of possible elements, the codes in Table A, i.e. the SBC-A codes, are correspondingly shorter. The fact that the SBC-A codes are used significantly more frequently than the SBC-B codes also has an advantageous effect on the compression.

[0020]FIG. 2 shows an example of an XML schema text and FIGS. 2a and 2 b show the associated node tables for SBC-A and SBC-B. From these, it is clear that the schema branch codes for the SBC-A can be shortened, because here there is no need to reference the Simple Type elements and Attributes.

[0021] Improved Search Function

[0022] A functionality which is required by the binary representation but which, with the method according to the ISO/IEC draft, cannot however be used without restriction is a simplified search in the document for certain elements. Ideally, it should be possible to perform this search using a simple filter mechanism, by using a comparison against a bit pattern to search in the bitstream for a predefined bit sequence which uniquely addresses the element sought in the document. To search rapidly for a particular element in the document tree, the bitstream will then be parsed and closer attention will only be given to those elements which are addressed by the correct path fragment. For the method as carried out in the ISO/IEC draft, this type of filtering cannot be performed without restriction, because the length of the #Position codes cannot be determined in advance if there is at least one element in the schema for which the maximum number is here greater than 7 or is unlimited.

[0023] In the method according to the invention, the tree branching nodes (TBCs) which specify the path are subject to a partial re-sorting, with the objective of enabling a simple filtering of the bitstream. This moves the #Position codes to the end of the path. The advantage of this is that the first part of the path, which contains the #SchemaBranch fragments, by itself specifies the type of the element referenced.

[0024] In an alternative solution, a first step separates the #Position codes into a part with a fixed length and a part with a variable length. In a second step, the parts with variable length are taken out of the TBCs and are moved to the end of the path.

[0025] With absolute addresses it is then possible, when searching for a particular element, to define in advance the bit pattern. When relative addresses are being used, the pattern depends on the current position within the document. For this situation, the new methods produces a simplification in that the #Position codes do not need to be decoded and analyzed for filtering purposes.

[0026] For a complete reference, the complete path including the complete #Position codes must be read and decoded, to enable correct branching at each node into the child-element referenced.

[0027] To simplify the implementation of this method, it is possible to send at the start of the path a specification of the overall length L of the path, typically in bits, excluding the #Position codes at the end, so that a pointer Z for the #Position codes can be simultaneously updated, and hence the correct positions can be decoded in parallel with the SBCs. In addition, this will also make possible a search of particular positions (#Positions) for the elements sought, and will also support a search in the case of extendibility, as explained below, in which a part of the path is not known to every decoder.

[0028]FIG. 3a illustrates these relationships by an example of the addressing of a Simple Type element or Attribute, under the previous method. FIG. 3b shows the corresponding example for the method in accordance with the invention. From FIG. 3b it is clear that all the schema branch codes SBC-B1 . . . SBC-B5 for any particular path are arranged one after another and in total have a length L, which is transmitted at the very beginning as the first item. The position codes #pos 1 . . . #pos 5 are separated from the SBCs and are arranged one after another. The bit pattern for absolute addressing with a bit length of L can be determined from the schema definition, so that it is possible to filter the bitstream by comparing it against a bit pattern.

[0029] Improvement in Extendibility

[0030] The coding schema, on which the algorithm of the ISO/IEC draft is based, is context-sensitive, i.e. the coding in each element includes only those other possibilities defined by the context. The decoder can only read the bitstream and interpret it correctly if it knows the schema definition. The decoder must know which TBC code refers to which element, and how long the bit code in each element is, so that the correct number of bits is read for each path fragment.

[0031] A situation which will often arise in practice is that a defined schema is retrospectively extended, to take account of new conditions, such as new categories of metadata. These extensions can be optional elements or attributes. Documents held in XML text form, which were produced in accordance with the old schema definition, continue to be valid in relation to the new definition (forward compatibility). However, these can also be data types derived by inheritance which, in the case of a restriction (derived by restriction), retain the TBCs or, for an extension (derived by extension), are given an extended TBC table as described below.

[0032] However, in the binary representation of documents, such as are shown in the ISO/IEC draft for example, this is not the case, because here new elements/attributes can be allocated TBCs which previously addressed other elements/attributes. In the method according to the invention this disadvantage can, however, be avoided by using the following rules:

[0033] New, optional, elements can only be inserted into the Tree Structure Nodes (TSNs) following existing elements, and only before any Path Termination Codes which may be present. When this is done, these new elements will be assigned schema branch codes (SBCs) which have not yet been assigned; in doing so any existing elements will not lose their schema branch code assignments.

[0034] If the extension would lead to addressing which uses longer addresses, then any binary representations would no longer be decodable, due to the change in the code length. In order to solve this problem, then in accordance with the invention the following addressing is introduced:

[0035] With respect to the schema branching code, new elements/attributes are entered after existing elements/attributes and before any existing path terminations in the tree structure nodes, TSN. In this case, if no more schema branch codes are available, then the addressing will be extended by one or more bits, for example the most significant bit. For example, the existing codes will be extended by adding a zero. An exception is the Path Termination Codes, which are extended by 1 so that they remain the last code in the tree structure node. New elements/attributes are then assigned corresponding to the newly available schema branch codes, SBC. The change in the bit length for the schema branch code must be signaled to the decoder. In order to make possible incremental extensions, preceding versions of the schema must be known to the decoder. For this purpose, it is not necessary to save all the information for the versions concerned. Instead, only the bit length or the number of schema branch codes for the new versions of an appropriately modified tree structure node need to be saved, and transmitted if necessary, where the second possibility may have advantages in enabling erroneous codes to be recognized. These details must be transmitted before the coded schema branch codes which have been changed. In this way, the bit lengths of the schema branch codes are linked to the version numbers of the schema. Before a document is binary encoded, it is then only necessary to specify the version of the schema used, and not to transmit the entire schema used as has been necessary until now. For example, the bitstream definition of the ISO/IEC draft can be extended by adding a field for specifying the version. If no version check is carried out, a schema definition from a standard, for example MPEG-7, can be used as a reliably known reference. This schema definition could be designated, for example, as version 1. An exemplary embodiment of such version details is given below:

[0036] In this case, both the version details and the bit length information are stored as additional items in the stream header, as this is specified in the ISO/IEC draft. For this purpose, the data as shown in FIG. 4a is stored in the datastream.

[0037] The standardized versions can be assigned a unique version identifier, which is designated M7_Version_ID in FIG. 4a. Furthermore, proprietary extensions can be identified by an extension identifier, which is designated Extension_ID in FIG. 4a. This can be specified even if the bit lengths of the extended tree structure nodes TSN are stored in the bitsteam. As shown in FIG. 4a, this is signaled by a flag, DS_Extension. The bit length information for the tree branch codes TBC of the extended tree structure nodes TSN is coded in the DS_Update_Info( ) specified in FIG. 4a, as shown in FIG. 4b. The expression Number_of_changed_nodes signals the number of tree structure nodes which have been changed. This number can be coded with a variable length, corresponding to the position data suggested in the ISO/IEC draft.

[0038] The information about the changed tree structure nodes can be addressed in the bitstream by a navigation command, Navigation_Command, and a navigation path, Navigation_Path. The change details transmitted thereafter then apply for all elements which are of the same type as the node addressed. After this, the changed codeword length SBC_Length or the changed number of schema branch codes is inserted into the datastream. The codeword length or number is again coded in accordance with the same method as used for coding the Number_of_changed_nodes.

[0039] In a further exemplary embodiment, the changed tree structure nodes can be identified by direct addressing of the Complex Types in the schema. This direct addressing can be achieved, for example, by numbering off the Complex Types defined in the schema.

[0040] There is a further problem, in that a document coded in accordance with the new schema should be decoded by a decoder to which only the earlier schema definition is known (backward compatibility). In an XML textual document based on XML this is possible for elements which were already known under the old schema. This depends on two properties:

[0041] The elements of the complex type defined in the old schema continue to be retained, but can differ in the elements and attributes or the data types, as applicable, which they contain.

[0042] By using start and end markers for the elements, so-called Tags, new elements can be skipped and known ones decoded.

[0043] If the bit length change is transmitted for different versions, as specified in the above addressing proposal, then an “old” decoder which is working on the basis of an earlier schema can still decode known elements in an extended tree structure node. However, path specifications which lead to a new element cannot be skipped by the “old” decoder, and it cannot decode any further. In order to support this important functionality, the method according to the invention uses the following alternatives for backward compatible coded documents:

[0044] a) If new elements/attributes are addressed in a TSN, then the transmission includes in addition, at the start, the number of bits for the complete sub-tree or successor tree for this element/attribute, including the N bit content data which has been inserted. In this way, the decoder is enabled to skip over the next N bits, which are coded in a way unknown to it, and to land back in the known TSN again.

[0045] b) After the transmission of a path which contains a new element/attribute, a unique synchronization sequence is communicated, which the decoder can use to land back in the known TSN again.

[0046] c) Before transmitting any paths which contain new elements, their TSNs, which represent a part of a complete schema, must first be transmitted.

[0047] d) Before transmitting any paths which contain new elements, the complete schema must first be transmitted.

[0048] In the case of alternatives c) and d), the decoder can also decode the content of the newly appended documents and, where applicable, can save it or subject it to further processing.

[0049] The example illustrated in FIGS. 5a and 5 b shows the changes when there is a new version of a schema definition, with FIG. 5a showing an extended tree structure node for a Complex Type element and FIG. 5b showing an extended tree structure node for a modified schema. The elements 3 to 6 have been added in the new version. This causes the length of the schema branch code to increase from two to three. However, the previously-existing addresses are retained, except that they are extended by the addition of a zero as the MSB.

[0050] There follows an example of the coding of extended schema elements, shown in FIGS. 6a and 6 b. Here, the example used in conjunction with FIG. 2 serves as the starting point. For reasons of simplicity, the method described above for splitting up the node table is ignored in this illustration. The original schema “PurchaseOrderType” is to be extended by a number of elements. In FIG. 6a, the elements which are extensions compared to FIG. 2 are highlighted in boldface.

[0051] That is to say, the elements “billTo”, “MethodOfPayment” together with “BankData” are new insertions. The new tree branch code table must therefore be correspondingly extended. As a consequence, three bits is no longer sufficient to encode all the possibilities.

[0052] How this extension is effected using a tree branch code of four bits is itemized in more detail in FIG. 6b.

[0053] Under these general conditions, two cases are now dealt with:

[0054] Case 1:

[0055] Documents which have been coded in accordance with the old schema definition are transmitted to a decoder to which the new schema is known. The version number of the schema on which the coded document is based must be the first item communicated to the decoder. In this connection, the decoder has a table, in which is stored for each version number the bit width or the number of schema branch codes SBC for all the elements. Using this, the decoder determines that elements of type “PurchaseOrderType” are coded not with four bits but rather with only three bits. This information by itself permits it to decode the document correctly.

[0056] Case 2:

[0057] Documents which have been coded in accordance with the new schema definition are transmitted to a decoder which knows only the old schema. By reference to the version number of the schema, the decoder recognizes that unknown elements could be transmitted, and that known elements could be coded with a different bit width. The new bit width of the elements must be known to the decoder, or else it would lose its synchronization with the encoder. Either the information assigning a bit width to the individual elements, for example a table, is transmitted before the actual document, or the decoder can access this information under a specified address (URI).

[0058] Under the method according to the invention, the encoder has four options for coding the document:

[0059] Option 1:

[0060] For each new element, the length of the corresponding sub-tree is transmitted, as shown in FIG. 7.

[0061] By reference to the schema branch code 0101, the decoder recognizes that the element addressed is not contained in the standard schema. Accordingly, it interprets the next bits as the length L of the unknown element. This length could be specified in accordance with the adaptive variable integer coding, as specified in the ISO/IEC draft. Using this length specification, it skips over the “billTo” sub-tree and resumes at the #SchemaBranch code 0010. The following element “Command” is then one which it is again able to decode.

[0062] Option 2:

[0063] After a new element a unique synchronization sequence is transmitted, as shown in FIG. 8. The decoder parses the bitstream until it finds a Resyncmarker as defined by the standard, from which point it continues the decoding. This method offers the possibility of coding a number of new elements without a break, and only transmitting the resync marker after the last of them.

[0064] Option 3:

[0065] The tree structure nodes which contain the new elements, together with their position in the document tree, are transmitted before the actual document. With this method, therefore, the schema which is known to the decoder is updated. The transmission of the document then takes place in accordance with the case that the schema is known. In addition, it can use the newly-transmitted schema to add the new elements to the ones of which it is internally aware, provided that a unique version number is assigned to identify the new schema.

[0066] Option 4:

[0067] A complete new schema is transmitted. In this case, the decoder can handle the document like one coded in accordance with a known schema. In addition, it can use the newly-transmitted schema to add the new elements to the ones of which it is internally aware, provided that a unique version number is assigned to identify the new schema.

[0068] The individual methods in accordance with the invention can be used independently of each other or in combination. 

1. Method for improving the functionality of a binary representation of an XML-based content description, where the structure of any instance of an XML document corresponds to a tree-like data structure, whereby each tree node represents an element of the content description and has a structure which is defined in a schema, and whereby the schema has tree nodes with a tree branch code (TBC), whereby the tree branch code has schema branch codes and, if there are multiple occurrences of associated child nodes after the definition of the schema, also has position codes (#pos), whereby two different tables are formed for schema branch codes when each node is being coded, whereby the first table (SBC-A) contains only exclusively complex elements and a path termination code whose data structure permits a branch to child nodes, and the second table (SBC-B) contains not only the complex elements but also attributes and simple elements, which represent the leaves of the tree-like data structure, and whereby any particular complete path is formed by chaining together tree nodes in such a way that, except for the last node in the complete path, only tree nodes in the first table are referenced, the last tree node is taken from the second table, and the penultimate node of the path contains a path termination code.
 2. Method for improving the functionality of a binary representation of an XML-based content description, whereby the structure of any instance of an XML document corresponds to a tree-like data structure, whereby each tree node represents an element of the content description and has a structure which is defined in a schema, and whereby the schema has tree nodes with a tree branch code (TBC), whereby the tree branch code has schema branch codes and, if there are multiple occurrences of associated child nodes after the definition of the schema, also has position codes (#pos), and whereby any overall path is re-sorted in such a way that all the position codes are moved to the end of this path.
 3. Method in accordance with claim 2, whereby a specification of the total length (L) of the path is sent at the start of each complete path, whereby only the schema branch codes are recorded and not the position codes.
 4. Method in accordance with claim 2, whereby the position codes are split into a part with a fixed length and a part with a variable length, and the parts with variable length are removed from the tree branch codes and are moved to the end of the path.
 5. Method for improving the functionality of a binary representation of an XML-based content description, whereby the structure of any instance of an XML document corresponds to a tree-like data structure, whereby each tree node represents an element of the content description and has a structure which is defined in a schema, and whereby the schema has tree nodes with a tree branch code (TBC), whereby the tree branch code has schema branch codes, whereby an existing schema is extended by utilizing unused schema branch codes in a tree node for extensions with new elements until they are all used up, and then the bit length (B) of the schema branch code is increased as necessary, and whereby a bit length change is communicated to the decoder so that it can correctly decode the content description.
 6. Method in accordance with claim 5, whereby at least one version of the schema is saved in the decoder and the only data sent is that for calling up the schema change relative to a saved version or a schema change relative to a saved version is transmitted directly.
 7. Method for improving the functionality of a binary representation of an XML-based content description, whereby the structure of any instance of an XML document corresponds to a tree-like data structure, whereby each tree node represents an element of the content description and has a structure which is defined in a schema, and whereby the schema has tree nodes with a tree branch code (TBC), whereby the tree branch code has [lacuna], whereby the decoder reads past any paths with unknown elements, either by the number of bits comprising the element concerned and its sub-tree being transmitted and the decoder skipping over this number of bits, or by the communication of a unique synchronization sequence after the path with a new element has been transmitted, so that the decoder then restarts only when it reaches a tree node which belongs to the known schema.
 8. Method for improving the functionality of a binary representation of an XML-based content description, whereby the structure of any instance of an XML document corresponds to a tree-like data structure, whereby each tree node represents an element of the content description and has a structure which is defined in a schema, and whereby the schema has tree nodes with a tree branch code (TBC), whereby the tree branch code has schema branch codes, whereby the decoder decodes paths with new elements, which do not conform to the previous schema, by communication to the decoder either beforehand of the associated tree structure nodes or of a completely new schema. 